'use client';

import { ReactNode } from 'react';
import { ProtectedRoute } from './auth/protected-route';
import { usePathname } from 'next/navigation';

interface ProvidersProps {
  children: ReactNode;
}

export function Providers({ children }: ProvidersProps) {
  const pathname = usePathname();
  const isAuthPage = pathname === '/auth/login';

  // 如果是登录页，不需要路由保护
  if (isAuthPage) {
    return <>{children}</>;
  }

  // 其他页面需要路由保护
  return (
    <ProtectedRoute>
      {children}
    </ProtectedRoute>
  );
} 